 
 	<?php
		function set_val($obj, $val, $return='echo')
		{
			if(isset($obj))
				if(isset($obj->$val))
					if($return=='echo')
						echo($obj->$val);
					else
						return $obj->$val;
		}
	?>
 
		<div><br>
			<form id="form" class="block-content form" action="<?php echo $form_action?>" method="post">
				<input type="hidden" id="id" name="id" value="<?php echo $id?>" />
				<div class="_100">
					<p><label for="note">History</label>
					<textarea id="note" name="note" class="" rows="2" cols="40"><?php set_val($history,'note')?></textarea>
					</p>
				</div>

				<div class="clear"></div>
				<div class="block-actions">
					<ul class="actions-left">
						<li><a class="button red" id="reset-validate-form" href="javascript:void(0);">Reset</a></li>
					</ul>
					<ul class="actions-right">
						<li><input type="submit" class="button" value="Save!"></li>
					</ul>
				</div>
			</form>

		</div>
				
				
	<script type="text/javascript">
						
		
	$().ready(function() {
		

		
		
		/** Submit Form **/
		$("#form").validate({
				rules:{},
				messages: {},
				submitHandler: function(form) {
				   //submit
				$.post("<?php echo $form_action?>", $("#form").serialize(),
					function(data){
						if(data){
							
							newdata = $.parseJSON(data);
							
							if(newdata.error){
								Gtheme = 'error';
								
								$.each(newdata.msg, function(index) {
									$.jGrowl(newdata.msg[index], { theme: Gtheme,position:'center'  });
								});

							}
							else{
								Gtheme = 'saved';
								$.jGrowl(newdata.msg, { theme: Gtheme,position:'center'  });
								$("#dialog").dialog('close');
							}

						}
						else{
							$.jGrowl("Error!", { theme: 'error' });
						}
						
					
					});
				}
			});
		/** End Submit Form **/
		
		});
		
		
    </script>

